<html><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <title>Chapter 14. Behaviour-Driven Development</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <link rel="stylesheet" href="docbook.css" tppabs="http://www.phpunit.de/manual/current/en/docbook.css" type="text/css"></link>
</head>
<body>

<div id="header">
  <h1>PHPUnit Manual</h1>

  <ul>
<li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.4/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.4/en/index.html'" tppabs="http://www.phpunit.de/manual/3.4/en/index.html">PHPUnit 3.4 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.3/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.3/en/index.html'" tppabs="http://www.phpunit.de/manual/3.3/en/index.html" class="active">PHPUnit 3.3 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.2/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.2/en/index.html'" tppabs="http://www.phpunit.de/manual/3.2/en/index.html">PHPUnit 3.2 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.1/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.1/en/index.html'" tppabs="http://www.phpunit.de/manual/3.1/en/index.html">PHPUnit 3.1 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.0/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.0/en/index.html'" tppabs="http://www.phpunit.de/manual/3.0/en/index.html">PHPUnit 3.0 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/2.3/en/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/2.3/en/index.html'" tppabs="http://www.phpunit.de/manual/2.3/en/index.html">PHPUnit 2.3 <span><small>English</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.3/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.3/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.3/ja/index.html">PHPUnit 3.3 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.2/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.2/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.2/ja/index.html">PHPUnit 3.2 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.1/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.1/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.1/ja/index.html">PHPUnit 3.1 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/3.0/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/3.0/ja/index.html'" tppabs="http://www.phpunit.de/manual/3.0/ja/index.html">PHPUnit 3.0 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/2.3/ja/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/2.3/ja/index.html'" tppabs="http://www.phpunit.de/manual/2.3/ja/index.html">PHPUnit 2.3 <span><small>Japanese</small></span></a></li><li><a href="javascript:if(confirm('http://www.phpunit.de/manual/2.3/de/index.html  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/2.3/de/index.html'" tppabs="http://www.phpunit.de/manual/2.3/de/index.html">PHPUnit 2.3 <span><small>German</small></span></a></li>
  </ul>
</div>
<div class="colmask leftmenu">
  <div class="colleft">
    <div class="col1">
      <table border="0" width="100%">
        <tr>
          <td align="left"><a accesskey="p" href="test-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html">Prev</a></td>
          <td align="right"><a accesskey="n" href="code-coverage-analysis.html" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html">Next</a></td>
        </tr>
      </table>
<div class="chapter" title="Chapter 14. Behaviour-Driven Development"><div class="titlepage"><div><div><h2 class="title"><a id="behaviour-driven-development"></a>Chapter 14. Behaviour-Driven Development</h2></div></div></div><p>
    <a id="id2566976" class="indexterm"></a>
    <a id="id2566982" class="indexterm"></a>

    In <a class="xref" href="appendixes.bibliography.html#Astels2006" tppabs="http://www.phpunit.de/manual/current/en/appendixes.bibliography.html#Astels2006" title="A New Look at Test-Driven Development">[<abbr class="abbrev">Astels2006</abbr>]</a>, Dave Astels makes the following points:
  </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
        <a class="ulink" href="javascript:if(confirm('http://en.wikipedia.org/wiki/Extreme_Programming  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://en.wikipedia.org/wiki/Extreme_Programming'" tppabs="http://en.wikipedia.org/wiki/Extreme_Programming" target="_top">Extreme Programming</a>
        originally had the rule to test everything that could possibly break.
      </p></li><li class="listitem"><p>
        Now, however, the practice of testing in Extreme Programming has evolved
        into <a class="ulink" href="javascript:if(confirm('http://en.wikipedia.org/wiki/Test-driven_development  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://en.wikipedia.org/wiki/Test-driven_development'" tppabs="http://en.wikipedia.org/wiki/Test-driven_development" target="_top">Test-Driven Development</a>
        (see <a class="xref" href="test-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html" title="Chapter 13. Test-Driven Development">Chapter 13</a>).
      </p></li><li class="listitem"><p>
        But the tools still force developers to think in terms of tests and
        assertions instead of specifications.
      </p></li></ul></div><div class="blockquote" title="So if it's not about testing, what's it about?"><table border="0" width="100%" cellspacing="0" cellpadding="0" class="blockquote" summary="Block quote"><tr><td width="10%" valign="top"> </td><td width="80%" valign="top"><div class="blockquote-title"><p><b>So if it's not about testing, what's it about?</b></p></div><p>
      It's about figuring out what you are trying to do before you run off
      half-cocked to try to do it. You write a specification that nails down a
      small aspect of behaviour in a concise, unambiguous, and executable form.
      It's that simple. Does that mean you write tests? No. It means you write
      specifications of what your code will have to do. It means you specify the
      behaviour of your code ahead of time. But not far ahead of time. In fact,
      just before you write the code is best because that's when you have as
      much information at hand as you will up to that point. Like well done TDD,
      you work in tiny increments... specifying one small aspect of behaviour at
      a time, then implementing it.
    </p><p>
      When you realize that it's all about specifying behaviour and not writing
      tests, your point of view shifts. Suddenly the idea of having a Test class
      for each of your production classes is ridiculously limiting. And the
      thought of testing each of your methods with its own test method (in a 1-1
      relationship) will be laughable.
    </p></td><td width="10%" valign="top"> </td></tr><tr><td width="10%" valign="top"> </td><td colspan="2" align="right" valign="top">--<span class="attribution">Dave Astels</span></td></tr></table></div><p>
    <a id="id2568062" class="indexterm"></a>
    <a id="id2568069" class="indexterm"></a>

    The focus of <a class="ulink" href="javascript:if(confirm('http://en.wikipedia.org/wiki/Behavior_driven_development  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://en.wikipedia.org/wiki/Behavior_driven_development'" tppabs="http://en.wikipedia.org/wiki/Behavior_driven_development" target="_top">Behaviour-Driven Development</a>
    is "the language and interactions used in the process of software development.
    Behavior-driven developers use their native language in combination with the
    ubiquitous language of <a class="ulink" href="javascript:if(confirm('http://en.wikipedia.org/wiki/Domain_driven_design  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://en.wikipedia.org/wiki/Domain_driven_design'" tppabs="http://en.wikipedia.org/wiki/Domain_driven_design" target="_top">Domain-Driven Design</a>
    to describe the purpose and benefit of their code. This allows the developers
    to focus on why the code should be created, rather than the technical details,
    and minimizes translation between the technical language in which the code
    is written and the domain language spoken by the" domain experts.
  </p><p>
    <a id="id2568099" class="indexterm"></a>

    The <code class="literal">PHPUnit_Extensions_Story_TestCase</code> class adds a story
    framework that facilitates the definition of a
    <a class="ulink" href="javascript:if(confirm('http://en.wikipedia.org/wiki/Domain-specific_programming_language  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://en.wikipedia.org/wiki/Domain-specific_programming_language'" tppabs="http://en.wikipedia.org/wiki/Domain-specific_programming_language" target="_top">Domain-Specific Language</a>
    for Behaviour-Driven Development. Inside a <span class="emphasis"><em>scenario</em></span>,
    <code class="literal">given()</code>, <code class="literal">when()</code>, and
    <code class="literal">then()</code> each represent a <span class="emphasis"><em>step</em></span>.
    <code class="literal">and()</code> is the same kind as the previous step. The following
    methods are declared <code class="literal">abstract</code> in
    <code class="literal">PHPUnit_Extensions_Story_TestCase</code> and need to be
    implemented:
  </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p><code class="literal">runGiven(&amp;$world, $action, $arguments)</code></p><p>...</p></li><li class="listitem"><p><code class="literal">runWhen(&amp;$world, $action, $arguments)</code></p><p>...</p></li><li class="listitem"><p><code class="literal">runThen(&amp;$world, $action, $arguments)</code></p><p>...</p></li></ul></div><div class="section" title="BowlingGame Example"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="behaviour-driven-development.bowlinggame-example"></a>BowlingGame Example</h2></div></div></div><p>
      In this section, we will look at the example of a class that calculates
      the score for a game of bowling. The rules for this are as follows:
    </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>The game consists of 10 frames.</p></li><li class="listitem"><p>In each frame the player has two opportunities to knock down 10 pins.</p></li><li class="listitem"><p>The score for a frame is the total number of pins knocked down, plus bonuses for strikes and spares.</p></li><li class="listitem"><p>A spare is when the player knocks down all 10 pins in two tries.</p><p>The bonus for that frame is the number of pins knocked down by the next roll.</p></li><li class="listitem"><p>A strike is when the player knocks down all 10 pins on his first try.</p><p>The bonus for that frame is the value of the next two balls rolled.</p></li></ul></div><p>
      <a class="xref" href="behaviour-driven-development.html#behaviour-driven-development.bowlinggame-example.examples.BowlingGameSpec.php" tppabs="http://www.phpunit.de/manual/current/en/behaviour-driven-development.html#behaviour-driven-development.bowlinggame-example.examples.BowlingGameSpec.php" title="Example 14.1: Specification for the BowlingGame class">Example 14.1</a>
      shows how the above rules can be written down as specification scenarios
      using <code class="literal">PHPUnit_Extensions_Story_TestCase</code>.
    </p><div class="example"><a id="behaviour-driven-development.bowlinggame-example.examples.BowlingGameSpec.php"></a><p class="title"><b>Example 14.1: Specification for the BowlingGame class</b></p><div class="example-contents"><pre class="programlisting"><code><span class="default">&lt;?php</span><br /><span class="keyword">require_once</span><span class="default">&nbsp;</span><span class="string">'PHPUnit/Extensions/Story/TestCase.php'</span><span class="keyword">;</span><br /><span class="keyword">require_once</span><span class="default">&nbsp;</span><span class="string">'BowlingGame.php'</span><span class="keyword">;</span><br /><span class="default">&nbsp;</span><br /><span class="keyword">class</span><span class="default">&nbsp;</span><span class="default">BowlingGameSpec</span><span class="default">&nbsp;</span><span class="keyword">extends</span><span class="default">&nbsp;</span><span class="default">PHPUnit_Extensions_Story_TestCase</span><br /><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">/**</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@scenario</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">scoreForGutterGameIs0</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">given</span><span class="keyword">(</span><span class="string">'New&nbsp;game'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">then</span><span class="keyword">(</span><span class="string">'Score&nbsp;should&nbsp;be'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">0</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">/**</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@scenario</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">scoreForAllOnesIs20</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">given</span><span class="keyword">(</span><span class="string">'New&nbsp;game'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">when</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">1</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">then</span><span class="keyword">(</span><span class="string">'Score&nbsp;should&nbsp;be'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">20</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">/**</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@scenario</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">scoreForOneSpareAnd3Is16</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">given</span><span class="keyword">(</span><span class="string">'New&nbsp;game'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">when</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">5</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">5</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">3</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">then</span><span class="keyword">(</span><span class="string">'Score&nbsp;should&nbsp;be'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">16</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">/**</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@scenario</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">scoreForOneStrikeAnd3And4Is24</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">given</span><span class="keyword">(</span><span class="string">'New&nbsp;game'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">when</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">3</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">4</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">then</span><span class="keyword">(</span><span class="string">'Score&nbsp;should&nbsp;be'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">24</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">/**</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*&nbsp;@scenario</span><br /><span class="comment">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">scoreForPerfectGameIs300</span><span class="keyword">(</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">given</span><span class="keyword">(</span><span class="string">'New&nbsp;game'</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">when</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">and</span><span class="keyword">(</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">10</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">-&gt;</span><span class="default">then</span><span class="keyword">(</span><span class="string">'Score&nbsp;should&nbsp;be'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">300</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">runGiven</span><span class="keyword">(</span><span class="keyword">&amp;</span><span class="default">$world</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$action</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$arguments</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">switch</span><span class="keyword">(</span><span class="default">$action</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">case</span><span class="default">&nbsp;</span><span class="string">'New&nbsp;game'</span><span class="keyword">:</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'game'</span><span class="keyword">]</span><span class="default">&nbsp;&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">new</span><span class="default">&nbsp;</span><span class="default">BowlingGame</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'rolls'</span><span class="keyword">]</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">0</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">break</span><span class="keyword">;</span><br /><span class="default">&nbsp;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">default</span><span class="keyword">:</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">notImplemented</span><span class="keyword">(</span><span class="default">$action</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">runWhen</span><span class="keyword">(</span><span class="keyword">&amp;</span><span class="default">$world</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$action</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$arguments</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">switch</span><span class="keyword">(</span><span class="default">$action</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">case</span><span class="default">&nbsp;</span><span class="string">'Player&nbsp;rolls'</span><span class="keyword">:</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'game'</span><span class="keyword">]</span><span class="keyword">-&gt;</span><span class="default">roll</span><span class="keyword">(</span><span class="default">$arguments</span><span class="keyword">[</span><span class="default">0</span><span class="keyword">]</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'rolls'</span><span class="keyword">]</span><span class="keyword">++</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">break</span><span class="keyword">;</span><br /><span class="default">&nbsp;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">default</span><span class="keyword">:</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">notImplemented</span><span class="keyword">(</span><span class="default">$action</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br />&nbsp;<br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">runThen</span><span class="keyword">(</span><span class="keyword">&amp;</span><span class="default">$world</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$action</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$arguments</span><span class="keyword">)</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">switch</span><span class="keyword">(</span><span class="default">$action</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">case</span><span class="default">&nbsp;</span><span class="string">'Score&nbsp;should&nbsp;be'</span><span class="keyword">:</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">for</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="default">$i</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'rolls'</span><span class="keyword">]</span><span class="keyword">;</span><span class="default">&nbsp;</span><span class="default">$i</span><span class="default">&nbsp;</span><span class="keyword">&lt;</span><span class="default">&nbsp;</span><span class="default">20</span><span class="keyword">;</span><span class="default">&nbsp;</span><span class="default">$i</span><span class="keyword">++</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'game'</span><span class="keyword">]</span><span class="keyword">-&gt;</span><span class="default">roll</span><span class="keyword">(</span><span class="default">0</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">assertEquals</span><span class="keyword">(</span><span class="default">$arguments</span><span class="keyword">[</span><span class="default">0</span><span class="keyword">]</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$world</span><span class="keyword">[</span><span class="string">'game'</span><span class="keyword">]</span><span class="keyword">-&gt;</span><span class="default">score</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">break</span><span class="keyword">;</span><br /><span class="default">&nbsp;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">default</span><span class="keyword">:</span><span class="default">&nbsp;</span><span class="keyword">{</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="keyword">-&gt;</span><span class="default">notImplemented</span><span class="keyword">(</span><span class="default">$action</span><span class="keyword">)</span><span class="keyword">;</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span><br /><span class="keyword">}</span><br /><span class="default">?&gt;</span><br /></code></pre><pre class="screen"><strong class="userinput"><code>phpunit --story BowlingGameSpec</code></strong>
PHPUnit 3.3.0 by Sebastian Bergmann.

BowlingGameSpec
 [x] Score for gutter game is 0

   Given New game 
    Then Score should be 0

 [x] Score for all ones is 20

   Given New game 
    When Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
     and Player rolls 1
    Then Score should be 20

 [x] Score for one spare and 3 is 16

   Given New game 
    When Player rolls 5
     and Player rolls 5
     and Player rolls 3
    Then Score should be 16

 [x] Score for one strike and 3 and 4 is 24

   Given New game 
    When Player rolls 10
     and Player rolls 3
     and Player rolls 4
    Then Score should be 24

 [x] Score for perfect game is 300

   Given New game 
    When Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
     and Player rolls 10
    Then Score should be 300

Scenarios: 5, Failed: 0, Skipped: 0, Incomplete: 0.</pre></div></div><br class="example-break"></br></div></div>
      <table border="0" width="100%">
        <tr>
          <td align="left"><a accesskey="p" href="test-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html">Prev</a></td>
          <td align="right"><a accesskey="n" href="code-coverage-analysis.html" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html">Next</a></td>
        </tr>
      </table>
    </div>
    <div class="col2">
<dl><dt><span class="chapter"><a href="automating-tests.html" tppabs="http://www.phpunit.de/manual/current/en/automating-tests.html">1. 自动化测试</a></span></dt><dt><span class="chapter"><a href="goals.html" tppabs="http://www.phpunit.de/manual/current/en/goals.html">2. PHPUnit的目标</a></span></dt><dt><span class="chapter"><a href="installation.html" tppabs="http://www.phpunit.de/manual/current/en/installation.html">3. 安装PHPUnit</a></span></dt><dt><span class="chapter"><a href="writing-tests-for-phpunit.html" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html">4. 为PHPUnit编写测试</a></span></dt><dd><dl><dt><span class="section"><a href="writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers">Data Providers</a></span></dt><dt><span class="section"><a href="writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions">Testing Exceptions</a></span></dt><dt><span class="section"><a href="writing-tests-for-phpunit.html#writing-tests-for-phpunit.errors" tppabs="http://www.phpunit.de/manual/current/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.errors">Testing PHP Errors</a></span></dt></dl></dd><dt><span class="chapter"><a href="textui.html" tppabs="http://www.phpunit.de/manual/current/en/textui.html">5. The Command-Line Test Runner</a></span></dt><dt><span class="chapter"><a href="fixtures.html" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html">6. Fixtures</a></span></dt><dd><dl><dt><span class="section"><a href="fixtures.html#fixtures.more-setup-than-teardown" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.more-setup-than-teardown">More setUp() than tearDown()</a></span></dt><dt><span class="section"><a href="fixtures.html#fixtures.variations" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.variations">Variations</a></span></dt><dt><span class="section"><a href="fixtures.html#fixtures.sharing-fixture" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.sharing-fixture">Sharing Fixture</a></span></dt><dt><span class="section"><a href="fixtures.html#fixtures.global-state" tppabs="http://www.phpunit.de/manual/current/en/fixtures.html#fixtures.global-state">Global State</a></span></dt></dl></dd><dt><span class="chapter"><a href="organizing-tests.html" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html">7. Organizing Tests</a></span></dt><dd><dl><dt><span class="section"><a href="organizing-tests.html#organizing-tests.filesystem" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.filesystem">Composing a Test Suite Using the Filesystem</a></span></dt><dt><span class="section"><a href="organizing-tests.html#organizing-tests.xml-configuration" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.xml-configuration">Composing a Test Suite Using XML Configuration</a></span></dt><dt><span class="section"><a href="organizing-tests.html#organizing-tests.testsuite" tppabs="http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.testsuite">Using the TestSuite Class</a></span></dt></dl></dd><dt><span class="chapter"><a href="testcase-extensions.html" tppabs="http://www.phpunit.de/manual/current/en/testcase-extensions.html">8. TestCase Extensions</a></span></dt><dd><dl><dt><span class="section"><a href="testcase-extensions.html#testcase-extensions.output" tppabs="http://www.phpunit.de/manual/current/en/testcase-extensions.html#testcase-extensions.output">Testing Output</a></span></dt><dt><span class="section"><a href="testcase-extensions.html#testcase-extensions.performance" tppabs="http://www.phpunit.de/manual/current/en/testcase-extensions.html#testcase-extensions.performance">Testing Performance</a></span></dt></dl></dd><dt><span class="chapter"><a href="database.html" tppabs="http://www.phpunit.de/manual/current/en/database.html">9. Database Testing</a></span></dt><dd><dl><dt><span class="section"><a href="database.html#database.datasets" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets">Data Sets</a></span></dt><dd><dl><dt><span class="section"><a href="database.html#database.datasets.flatxml" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.flatxml">Flat XML Data Set</a></span></dt><dt><span class="section"><a href="database.html#database.datasets.xml" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.xml">XML Data Set</a></span></dt><dt><span class="section"><a href="database.html#database.datasets.csv" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.csv">CSV Data Set</a></span></dt><dt><span class="section"><a href="database.html#database.datasets.replacement" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.datasets.replacement">Replacement Data Set</a></span></dt></dl></dd><dt><span class="section"><a href="database.html#database.operations" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.operations">Operations</a></span></dt><dt><span class="section"><a href="database.html#database.bestpractices" tppabs="http://www.phpunit.de/manual/current/en/database.html#database.bestpractices">Database Testing Best Practices</a></span></dt></dl></dd><dt><span class="chapter"><a href="incomplete-and-skipped-tests.html" tppabs="http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html">10. Incomplete and Skipped Tests</a></span></dt><dd><dl><dt><span class="section"><a href="incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.incomplete-tests" tppabs="http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.incomplete-tests">Incomplete Tests</a></span></dt><dt><span class="section"><a href="incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests" tppabs="http://www.phpunit.de/manual/current/en/incomplete-and-skipped-tests.html#incomplete-and-skipped-tests.skipping-tests">Skipping Tests</a></span></dt></dl></dd><dt><span class="chapter"><a href="test-doubles.html" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html">11. Test Doubles</a></span></dt><dd><dl><dt><span class="section"><a href="test-doubles.html#test-doubles.stubs" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.stubs">Stubs</a></span></dt><dt><span class="section"><a href="test-doubles.html#test-doubles.mock-objects" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.mock-objects">Mock Objects</a></span></dt><dt><span class="section"><a href="test-doubles.html#test-doubles.mocking-the-filesystem" tppabs="http://www.phpunit.de/manual/current/en/test-doubles.html#test-doubles.mocking-the-filesystem">Mocking the Filesystem</a></span></dt></dl></dd><dt><span class="chapter"><a href="testing-practices.html" tppabs="http://www.phpunit.de/manual/current/en/testing-practices.html">12. Testing Practices</a></span></dt><dd><dl><dt><span class="section"><a href="testing-practices.html#testing-practices.during-development" tppabs="http://www.phpunit.de/manual/current/en/testing-practices.html#testing-practices.during-development">During Development</a></span></dt><dt><span class="section"><a href="testing-practices.html#testing-practices.during-debugging" tppabs="http://www.phpunit.de/manual/current/en/testing-practices.html#testing-practices.during-debugging">During Debugging</a></span></dt></dl></dd><dt><span class="chapter"><a href="test-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html">13. Test-Driven Development</a></span></dt><dd><dl><dt><span class="section"><a href="test-driven-development.html#test-driven-development.bankaccount-example" tppabs="http://www.phpunit.de/manual/current/en/test-driven-development.html#test-driven-development.bankaccount-example">BankAccount Example</a></span></dt></dl></dd><dt><span class="chapter"><a href="behaviour-driven-development.html" tppabs="http://www.phpunit.de/manual/current/en/behaviour-driven-development.html" class="active">14. Behaviour-Driven Development</a></span></dt><dd><dl><dt><span class="section"><a href="behaviour-driven-development.html#behaviour-driven-development.bowlinggame-example" tppabs="http://www.phpunit.de/manual/current/en/behaviour-driven-development.html#behaviour-driven-development.bowlinggame-example">BowlingGame Example</a></span></dt></dl></dd><dt><span class="chapter"><a href="code-coverage-analysis.html" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html">15. Code Coverage Analysis</a></span></dt><dd><dl><dt><span class="section"><a href="code-coverage-analysis.html#code-coverage-analysis.specifying-covered-methods" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.specifying-covered-methods">Specifying Covered Methods</a></span></dt><dt><span class="section"><a href="code-coverage-analysis.html#code-coverage-analysis.ignoring-code-blocks" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.ignoring-code-blocks">Ignoring Code Blocks</a></span></dt><dt><span class="section"><a href="code-coverage-analysis.html#code-coverage-analysis.including-excluding-files" tppabs="http://www.phpunit.de/manual/current/en/code-coverage-analysis.html#code-coverage-analysis.including-excluding-files">Including and Excluding Files</a></span></dt></dl></dd><dt><span class="chapter"><a href="other-uses-for-tests.html" tppabs="http://www.phpunit.de/manual/current/en/other-uses-for-tests.html">16. Other Uses for Tests</a></span></dt><dd><dl><dt><span class="section"><a href="other-uses-for-tests.html#other-uses-for-tests.agile-documentation" tppabs="http://www.phpunit.de/manual/current/en/other-uses-for-tests.html#other-uses-for-tests.agile-documentation">Agile Documentation</a></span></dt><dt><span class="section"><a href="other-uses-for-tests.html#other-uses-for-tests.cross-team-tests" tppabs="http://www.phpunit.de/manual/current/en/other-uses-for-tests.html#other-uses-for-tests.cross-team-tests">Cross-Team Tests</a></span></dt></dl></dd><dt><span class="chapter"><a href="skeleton-generator.html" tppabs="http://www.phpunit.de/manual/current/en/skeleton-generator.html">17. Skeleton Generator</a></span></dt><dd><dl><dt><span class="section"><a href="skeleton-generator.html#skeleton-generator.test" tppabs="http://www.phpunit.de/manual/current/en/skeleton-generator.html#skeleton-generator.test">Generating a Test Case Class Skeleton</a></span></dt><dt><span class="section"><a href="skeleton-generator.html#skeleton-generator.class" tppabs="http://www.phpunit.de/manual/current/en/skeleton-generator.html#skeleton-generator.class">Generating a Class Skeleton from a Test Case Class</a></span></dt></dl></dd><dt><span class="chapter"><a href="javascript:if(confirm('http://www.phpunit.de/manual/current/en/selenium.html  \n\nļδ Teleport Pro ȡأΪ ޷ȡãȡغĿֹ̫ͣ졣  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/current/en/selenium.html'" tppabs="http://www.phpunit.de/manual/current/en/selenium.html">18. PHPUnit and Selenium</a></span></dt><dd><dl><dt><span class="section"><a href="javascript:if(confirm('http://www.phpunit.de/manual/current/en/selenium.html  \n\nļδ Teleport Pro ȡأΪ ޷ȡãȡغĿֹ̫ͣ졣  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/current/en/selenium.html#selenium.selenium-rc'" tppabs="http://www.phpunit.de/manual/current/en/selenium.html#selenium.selenium-rc">Selenium RC</a></span></dt><dt><span class="section"><a href="javascript:if(confirm('http://www.phpunit.de/manual/current/en/selenium.html  \n\nļδ Teleport Pro ȡأΪ ޷ȡãȡغĿֹ̫ͣ졣  \n\nҪӷϴ'))window.location='http://www.phpunit.de/manual/current/en/selenium.html#selenium.seleniumtestcase'" tppabs="http://www.phpunit.de/manual/current/en/selenium.html#selenium.seleniumtestcase">PHPUnit_Extensions_SeleniumTestCase</a></span></dt></dl></dd><dt><span class="chapter"><a href="logging.html" tppabs="http://www.phpunit.de/manual/current/en/logging.html">19. Logging</a></span></dt><dd><dl><dt><span class="section"><a href="logging.html#logging.xml" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.xml">Test Results (XML)</a></span></dt><dt><span class="section"><a href="logging.html#logging.tap" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.tap">Test Results (TAP)</a></span></dt><dt><span class="section"><a href="logging.html#logging.json" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.json">Test Results (JSON)</a></span></dt><dt><span class="section"><a href="logging.html#logging.codecoverage" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.codecoverage">Code Coverage (XML)</a></span></dt><dt><span class="section"><a href="logging.html#logging.database" tppabs="http://www.phpunit.de/manual/current/en/logging.html#logging.database">Test Database</a></span></dt></dl></dd><dt><span class="chapter"><a href="build-automation.html" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html">20. Build Automation</a></span></dt><dd><dl><dt><span class="section"><a href="build-automation.html#build-automation.ant" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html#build-automation.ant">Apache Ant</a></span></dt><dt><span class="section"><a href="build-automation.html#build-automation.maven" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html#build-automation.maven">Apache Maven</a></span></dt><dt><span class="section"><a href="build-automation.html#build-automation.phing" tppabs="http://www.phpunit.de/manual/current/en/build-automation.html#build-automation.phing">Phing</a></span></dt></dl></dd><dt><span class="chapter"><a href="continuous-integration.html" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html">21. Continuous Integration</a></span></dt><dd><dl><dt><span class="section"><a href="continuous-integration.html#continuous-integration.atlassian-bamboo" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html#continuous-integration.atlassian-bamboo">Atlassian Bamboo</a></span></dt><dt><span class="section"><a href="continuous-integration.html#continuous-integration.cruisecontrol" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html#continuous-integration.cruisecontrol">CruiseControl</a></span></dt><dt><span class="section"><a href="continuous-integration.html#continuous-integration.phpUnderControl" tppabs="http://www.phpunit.de/manual/current/en/continuous-integration.html#continuous-integration.phpUnderControl">phpUnderControl</a></span></dt></dl></dd><dt><span class="chapter"><a href="api.html" tppabs="http://www.phpunit.de/manual/current/en/api.html">22. PHPUnit API</a></span></dt><dd><dl><dt><span class="section"><a href="api.html#api.overview" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.overview">Overview</a></span></dt><dt><span class="section"><a href="api.html#api.assert" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert">PHPUnit_Framework_Assert</a></span></dt><dd><dl><dt><span class="section"><a href="api.html#api.assert.assertArrayHasKey" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertArrayHasKey"><code class="literal">assertArrayHasKey()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertClassHasAttribute" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertClassHasAttribute"><code class="literal">assertClassHasAttribute()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertClassHasStaticAttribute" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertClassHasStaticAttribute"><code class="literal">assertClassHasStaticAttribute()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertContains" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertContains"><code class="literal">assertContains()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertContainsOnly" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertContainsOnly"><code class="literal">assertContainsOnly()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertEqualXMLStructure" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertEqualXMLStructure"><code class="literal">assertEqualXMLStructure()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertEquals" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertEquals"><code class="literal">assertEquals()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertFalse" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertFalse"><code class="literal">assertFalse()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertFileEquals" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertFileEquals"><code class="literal">assertFileEquals()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertFileExists" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertFileExists"><code class="literal">assertFileExists()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertGreaterThan" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertGreaterThan"><code class="literal">assertGreaterThan()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertGreaterThanOrEqual" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertGreaterThanOrEqual"><code class="literal">assertGreaterThanOrEqual()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertLessThan" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertLessThan"><code class="literal">assertLessThan()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertLessThanOrEqual" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertLessThanOrEqual"><code class="literal">assertLessThanOrEqual()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertNotNull" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertNotNull"><code class="literal">assertNotNull()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertObjectHasAttribute" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertObjectHasAttribute"><code class="literal">assertObjectHasAttribute()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertRegExp" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertRegExp"><code class="literal">assertRegExp()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSame" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSame"><code class="literal">assertSame()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSelectCount" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSelectCount"><code class="literal">assertSelectCount()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSelectEquals" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSelectEquals"><code class="literal">assertSelectEquals()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertSelectRegExp" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertSelectRegExp"><code class="literal">assertSelectRegExp()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertStringEqualsFile" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertStringEqualsFile"><code class="literal">assertStringEqualsFile()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertTag" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertTag"><code class="literal">assertTag()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertThat" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertThat"><code class="literal">assertThat()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertTrue" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertTrue"><code class="literal">assertTrue()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertType" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertType"><code class="literal">assertType()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertXmlFileEqualsXmlFile" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertXmlFileEqualsXmlFile"><code class="literal">assertXmlFileEqualsXmlFile()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertXmlStringEqualsXmlFile" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertXmlStringEqualsXmlFile"><code class="literal">assertXmlStringEqualsXmlFile()</code></a></span></dt><dt><span class="section"><a href="api.html#api.assert.assertXmlStringEqualsXmlString" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.assert.assertXmlStringEqualsXmlString"><code class="literal">assertXmlStringEqualsXmlString()</code></a></span></dt></dl></dd><dt><span class="section"><a href="api.html#api.test" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.test">PHPUnit_Framework_Test</a></span></dt><dt><span class="section"><a href="api.html#api.testcase" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testcase">PHPUnit_Framework_TestCase</a></span></dt><dt><span class="section"><a href="api.html#api.testsuite" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testsuite">PHPUnit_Framework_TestSuite</a></span></dt><dt><span class="section"><a href="api.html#api.testresult" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.testresult">PHPUnit_Framework_TestResult</a></span></dt><dt><span class="section"><a href="api.html#api.package-structure" tppabs="http://www.phpunit.de/manual/current/en/api.html#api.package-structure">Package Structure</a></span></dt></dl></dd><dt><span class="chapter"><a href="extending-phpunit.html" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html">23. Extending PHPUnit</a></span></dt><dd><dl><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestCase" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestCase">Subclass PHPUnit_Framework_TestCase</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.Assert" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.Assert">Assert Classes</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Extensions_TestDecorator" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Extensions_TestDecorator">Subclass PHPUnit_Extensions_TestDecorator</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_Test" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_Test">Implement PHPUnit_Framework_Test</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestResult" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestResult">Subclass PHPUnit_Framework_TestResult</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener">Implement PHPUnit_Framework_TestListener</a></span></dt><dt><span class="section"><a href="extending-phpunit.html#extending-phpunit.TestRunner" tppabs="http://www.phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.TestRunner">New Test Runner</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendixes.assertions.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.assertions.html">A. Assertions</a></span></dt><dt><span class="appendix"><a href="appendixes.configuration.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html">B. The XML Configuration File</a></span></dt><dd><dl><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.phpunit" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.phpunit">PHPUnit</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.testsuite" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.testsuite">Test Suite</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.groups" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.groups">Groups</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.blacklist-whitelist" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.blacklist-whitelist">Including and Excluding Files for Code Coverage</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.logging" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.logging">Logging</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.php-ini-constants-variables" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.php-ini-constants-variables">Setting PHP INI settings, Constants and Global Variables</a></span></dt><dt><span class="section"><a href="appendixes.configuration.html#appendixes.configuration.selenium-rc" tppabs="http://www.phpunit.de/manual/current/en/appendixes.configuration.html#appendixes.configuration.selenium-rc">Configuring Browsers for Selenium RC</a></span></dt></dl></dd><dt><span class="appendix"><a href="appendixes.index.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.index.html">C. Index</a></span></dt><dd><dl><dt><span class="index"><a href="appendixes.index.html#appendixes.index.index" tppabs="http://www.phpunit.de/manual/current/en/appendixes.index.html#appendixes.index.index"></a></span></dt></dl></dd><dt><span class="appendix"><a href="appendixes.bibliography.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.bibliography.html">D. Bibliography</a></span></dt><dt><span class="appendix"><a href="appendixes.copyright.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.copyright.html">E. Copyright</a></span></dt></dl>
    </div>
  </div>
</div>
<div id="footer">
  <p><a href="appendixes.copyright.html" tppabs="http://www.phpunit.de/manual/current/en/appendixes.copyright.html">Copyright</a> &copy; 2005-2009 <a href="javascript:if(confirm('http://sebastian-bergmann.de/  \n\nļδ Teleport Pro ȡأΪ ·ʼַõķΧ  \n\nҪӷϴ'))window.location='http://sebastian-bergmann.de/'" tppabs="http://sebastian-bergmann.de/">Sebastian Bergmann</a>.</p>
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www./");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-68261-7");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>

